package com.skiving.cloud.auth.config;

import cn.dev33.satoken.same.SaSameUtil;
import org.noear.nami.NamiBuilder;
import org.noear.nami.NamiConfiguration;
import org.noear.nami.annotation.NamiClient;
import org.noear.nami.channel.http.HttpChannel;
import org.noear.nami.coder.snack3.SnackDecoder;
import org.noear.nami.coder.snack3.SnackEncoder;
import org.noear.solon.annotation.Component;

@Component
public class ClientNamiConfiguration implements NamiConfiguration {
    /**
     * 配置客户端
     *
     * @param client client
     * @param builder builder
     */
    @Override
    public void config(NamiClient client, NamiBuilder builder) {
        builder.encoder(SnackEncoder.instance)
                .decoder(SnackDecoder.instance)
                .channel(HttpChannel.instance)
                .headerSet(SaSameUtil.SAME_TOKEN, SaSameUtil.getToken())
                .timeout(120);
    }
}
